#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=1e5+100;
typedef int LL;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
LL tree[maxn][11],pt=0;
LL endp[maxn*11];
string s[maxn];
bool cmp(string A,string B){
     if(A.size()==B.size()) return A<B;
     return A.size()<B.size();
}
bool ins(string& s){
     LL cur=0;
     for(int i=0;i<s.size();i++){
         char c=s[i]-'0';
         if(!tree[cur][c]) tree[cur][c]=++pt;
         cur=tree[cur][c];
         if(endp[cur]) return true;
     }
     endp[cur]++;
     return false;
}
int main(void){
   	cin.tie(0);std::ios::sync_with_stdio(false);
    LL t;cin>>t;
    while(t--){
        LL n;cin>>n;
        LL len=0;
        for(int i=0;i<n;i++){
            cin>>s[i];
        }
        sort(s,s+n,cmp);
        bool flag=false;
        for(int i=0;i<n;i++){
            len+=s[i].size();
            if(ins(s[i])){
               flag=true;
               break;
            }
        }
        if(flag){
            cout<<"NO"<<"\n";
        }else{
            cout<<"YES"<<"\n";
        }

        for(int i=0;i<=pt;i++){
            endp[i]=0;
            for(int j=0;j<10;j++) tree[i][j]=0;
        }
        pt=0;

    }
   	return 0;
}
